import Vue from 'vue'
//对应你要跳转的组件
//1.导入路由插件
import Router from 'vue-router'

//2.注册路由插件
Vue.use(Router)
const routes=[
    {
        path:'/index',//路由地址
        name:'index',//路由地址的别名
        component:()=>import('../components/index.vue'),//对应的组件,
        children:[
          {
            path:'/index/shangpin',//路由地址
            name:'shangpin',//路由地址的别名
            component:()=>import('../components/index/shangpin.vue'),//对应的组件,
            
          },
          {
            path:'/index/bbt',//路由地址
            name:'bbt',//路由地址的别名
            component:()=>import('../components/index/bbt.vue'),//对应的组件,
            
          },
          {
            path:'/index/dingdan',//路由地址
            name:'dingdan',//路由地址的别名
            component:()=>import('../components/index/dingdan.vue'),//对应的组件,
            
          },
          {
            path:'/index/my',//路由地址
            name:'my',//路由地址的别名
            component:()=>import('../components/index/my.vue'),//对应的组件,
            
          },
          {
            path:'/index',
            redirect:'/index/shangpin',
            component:()=>import('../components/index/shangpin.vue')
        },
        ]
    },
    {
         path: '/detail/:id',
         name: 'detail',
         meta:[ '详情页'],
         component: () => import('../components/detail.vue')
   },
   {
    path:'/shoucang',
    name:'shoucang',
    component:()=>import('../components/shoucang.vue')//对应的组件
},
    {
        path:'/login',
        name:'login',
        component:()=>import('../components/login.vue')//对应的组件
    },
    {
        path:'/register',
        name:'register',
        component:()=>import('../components/register.vue')//对应的组件
    },
   
    // {
    //     path:'/foot',
    //     name:'foot',
    //     component:()=>import('../components/foot.vue')//对应的组件
    // }
    ,{
      path:'/',
      redirect:'/index',
      component:()=>import('../components/index.vue')
  },
    ,{
        path:'*',
        component:()=>import('../components/NotFound.vue')
    },
]
//3.实例化路由管理对象
export default new Router({
    mode:'history',
    base:process.env.BASE_URL,
    routes
})
